--    Copyright 2012 University of Southampton
-- 
--    Licensed under the Apache License, Version 2.0 (the "License");
--    you may not use this file except in compliance with the License.
--    You may obtain a copy of the License at
-- 
--        http://www.apache.org/licenses/LICENSE-2.0
-- 
--    Unless required by applicable law or agreed to in writing, software
--    distributed under the License is distributed on an "AS IS" BASIS,
--    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--    See the License for the specific language governing permissions and
--    limitations under the License.

---Default data for table Users
SET IDENTITY_INSERT [HDCMetadata].[dbo].[Users] ON
GO
INSERT INTO [HDCMetadata].[dbo].[Users]
	([ID],[Username],[Name],[Email])
VALUES
	(0,'hdcsystem','HDC system account','unknown')
GO
SET IDENTITY_INSERT [HDCMetadata].[dbo].[Users] OFF
GO

--Default data for table groups
SET IDENTITY_INSERT [HDCMetadata].[dbo].[Groups] ON
GO
INSERT INTO [HDCMetadata].[dbo].[Groups]
           (ID,[Name],LeaderUserID)
     VALUES
           (0,'hdcadmins',0)
GO
SET IDENTITY_INSERT [HDCMetadata].[dbo].[Groups] OFF
GO

--Update default group for hdcsystem
UPDATE [HDCMetadata].[dbo].[Users]
SET DefaultGroupID=0
WHERE ID=0

--Default data for table ExperimentTypes
SET IDENTITY_INSERT [HDCMetadata].[dbo].[ExperimentTypes] ON
GO
INSERT INTO [HDCMetadata].[dbo].[ExperimentTypes]
	(ID,Name)
VALUES
	(0,'No type')
	,(-1,'FileStoreOptions')
	,(-2,'SharePointInterfaceOptions')
	,(-3,'Template')
GO
SET IDENTITY_INSERT [HDCMetadata].[dbo].[ExperimentTypes] OFF
GO

---Default data for table Experiments
SET IDENTITY_INSERT [HDCMetadata].[dbo].[Experiments] ON
GO
INSERT INTO [HDCMetadata].[dbo].[Experiments]
	(ID,Name,Owner,Date,Description,ExperimentTypeID,DefaultBasePath,IsDeleted)
VALUES
	(0,'none',0,CONVERT(datetime, '2000-01-01 00:00:00.000'),'Dummy experiment',0,'None',0)
    ,(-1,'File store options template',0,CONVERT(datetime, '2000-01-01 00:00:00.000'),'File store options template',-3,'None',1)
    ,(-2,'SharePoint options template',0,CONVERT(datetime, '2000-01-01 00:00:00.000'),'SharePoint options template',-3,'None',1)
GO
SET IDENTITY_INSERT [HDCMetadata].[dbo].[Experiments] OFF
GO

--Default data for table ExperimentDataFileTypes
SET IDENTITY_INSERT [HDCMetadata].[dbo].[ExperimentDataFileTypes] ON
GO
INSERT INTO [HDCMetadata].[dbo].[ExperimentDataFileTypes]
    (ID,Name,Description)
VALUES
    (0,'No type','Used if the data file does not have a type set')
GO
SET IDENTITY_INSERT [HDCMetadata].[dbo].[ExperimentDataFileTypes] OFF
GO

--Template parameters
INSERT INTO [HDCMetadata].[dbo].[ExperimentParameters]
	([ExperimentID],[Name],[Value],[Type],[IsCompulsory],[SourceExperimentParameterID])
VALUES
		(-1,'UNCPath','\\HDC\hdcdata','string',1,NULL)
		,(-1,'LocalPath','M:\hdcdata','string',1,NULL)
		,(-1,'WebPath','http://hdc/hdcdata','string',1,NULL)
		,(-1,'TrackingFolderName','.experiment','string',1,NULL)
		,(-1,'TrackingFileName','metadata.xml','string',1,NULL)
		,(-1,'BasePathDepthInWatchFolder','1','integer',1,NULL)
		,(-1,'FolderNameToIgnore','.experiment','string',1,NULL)
		,(-1,'FileNameToIgnore','.DS_Store','string',1,NULL)
		,(-1,'FileNameToIgnore','thumbs.db','string',1,NULL)
		,(-2,'SiteCollectionURL','http://hdcsharepoint','string',1,NULL)
GO

--Template mapping
INSERT INTO [HDCMetadata].[dbo].[ExperimentTypeExperimentTemplateMap]
           ([ExperimentTypeID],[TemplateExperimentID])
     VALUES
           (-1,-1)
           ,(-2,-2)
GO

